#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct Stu
{
	char name[20];
	int age;
};
int cmp1(const void* p, const void* q)
{
	return *(int*)p - *(int*)q;
}

int cmp2(const void* p, const void* q)
{
	return strcmp((char*)p,(char*)q);
}

int cmp3(const void* p, const void* q)
{
	return (strcmp(((struct Stu*)p)->name, ((struct Stu*)q)->name));
}

void print1(int* p, int sz)
{
	int i = 0;
	for (i = 0; i < sz; i++)
	{
		printf("%d ", *(p + i));
	}
	printf("\n");
}
void print2(char * p,int sz2)
{
	printf("%.8s", (p+1));
	printf("\n");
}
void print3(struct Stu * p, int sz)
{
	int i = 0;
	for (i = 0; i < sz; i++)
	{
		printf("%s %d ",(p+i)->name,(p+i)->age);
	}
	printf("\n");
}
int main()
{
	int arr1[] = { 9,7,8,0,6,5,4,3,2,1 };
	char arr2[] = "dcfabeg";
	struct Stu arr3[] = { {"zhangsan",30},{"lisi",18}, {"wangwu",20} };
	int sz1 = sizeof(arr1) / sizeof(arr1[0]);
	int sz2 = sizeof(arr2) / sizeof(arr2[0]);
	int sz3 = sizeof(arr3) / sizeof(arr3[0]);
	qsort(arr1,sz1,sizeof(arr1[0]),cmp1);
	print1(arr1, sz1);
	qsort(arr2, sz2, sizeof(arr2[0]), cmp2);
	print2(arr2,sz2);
	qsort(arr3, sz3, sizeof(arr3[0]), cmp3);
	print3(arr3, sz3);
	return 0;
}